package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class AddOperation implements Iop{
    @Override
    public void work(BookList bookList) {
        System.out.println("新增图书");
        int size = bookList.getNum();
        System.out.println("书名：");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("作者：");
        String man = scanner.nextLine();
        System.out.println("价格:");
        int price = scanner.nextInt();
        System.out.println("类型：");
        scanner.nextLine();
        String type = scanner.nextLine();
        Book book = new Book(name, man, price, type);
        bookList.setBooks(size ,book);
        bookList.setNum(size+1);
        System.out.println("新增成功！");
    }
}
